וַיִּתְחַתֵּ֣ן שְׁלֹמֹ֔ה אֶת־פַּרְעֹ֖ה מֶ֣לֶךְ מִצְרָ֑יִם וַיִּקַּ֣ח אֶת־בַּת־פַּרְעֹ֗ה וַיְבִיאֶ֙הָ֙ אֶל־עִ֣יר דָּוִ֔ד עַ֣ד כַּלֹּת֗וֹ לִבְנ֤וֹת אֶת־בֵּיתוֹ֙ וְאֶת־בֵּ֣ית יְהוָ֔ה וְאֶת־חוֹמַ֥ת יְרוּשָׁלִַ֖ם סָבִֽיב׃
און שלמה האָט זיך מתחתּן געװען מיט פּרעה דעם מלך פֿון מצרים, און ער האָט גענומען פּרעהס טאָכטער, און האָט זי געבראַכט אין דָוִדס-שטאָט, ביז ער האָט געענדיקט בױען זײַן הױז, און דאָס הױז פֿון גאָט, און די מױער פֿון ירושלים רונד אַרום.
Rashi
Shlomo became the son-in-law. As long as Shim’i, his teacher, was alive, he did not enter into marriage [with Pharaoh’s daughter]. From here, [our Sages derived and] declared, that a person should always live in the vicinity of his teacher.1Based on the juxtaposition of Shimi’s death and Shlomo’s marriage to Pharaoh’s daughter. See Maseches Berachos 8a.2In order to remain under his teacher’s guidance and influence.
Rashi
Until he finished building, etc. And afterwards he built a house for her.3Alternatively, after he finished building the Beis Hamikdosh, Shlomo moved Pharaoh’s daughter out of the City of Dovid which had become sanctified by the presence of the Ark.—Radak